package com.szqhyxj.youxiangju.biz.equipmentActivation.equipmentCardslot;

import com.alibaba.fastjson.JSON;
import com.google.gson.annotations.SerializedName;
import com.szqhyxj.youxiangju.sys.BaseResult;
import com.szqhyxj.youxiangju.sys.RetrofitFacade;

import org.json.JSONArray;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * Created by leung on 2018/11/3.
 */

public class EquipmentCardSlotModel  {

    private interface EquipmentCardSlotService{
        @POST("deviceinfo/getdeviceinfo")
        Observable<BaseResult<EquipmentCardSlotEntity>> deviceinfo();

        @FormUrlEncoded
        @POST("deviceinfo/getdeviceport")
        Observable<BaseResult<EquipmentSlotEntity>> cardSlotinfo(
                @Field("devNo") String devNo
        );

    }

    public static Observable<BaseResult<EquipmentCardSlotEntity>> getdeviceinfo(){
        return RetrofitFacade.Companion.getRetrofit().create(EquipmentCardSlotService.class)
                .deviceinfo();
    }

    public static Observable<BaseResult<EquipmentSlotEntity>> getCardSlotinfo(String devNo){
        return RetrofitFacade.Companion.getRetrofit().create(EquipmentCardSlotService.class)
                .cardSlotinfo(devNo);
    }
    public static class EquipmentCardSlotEntity{


        public String getAreaInfo() {
            return areaInfo;
        }

        public void setAreaInfo(String areaInfo) {
            this.areaInfo = areaInfo;
        }

        @SerializedName("areaInfo")
        private String areaInfo;

        @SerializedName("devNo")
        private String devNo;



        public void setDevNo(String devNo){
            this.devNo = devNo;
        }

        public String getDevNo(){
            return devNo;
        }

        @Override
         public String toString(){
            return
                "EquipmentEntity{" +
                "provCode = '" + areaInfo + '\'' +
                ",devNo = '" + devNo + '\'' +
                "}";
            }
    }

    public static class EquipmentSlotEntity{

        @SerializedName("brandType")
        private String brandType;

        @SerializedName("surplusPort")
        private int surplusPort;

        @SerializedName("posDevicePorts")
        private Map<String,String> posDevicePorts;

        public void setBrandType(String brandType){
            this.brandType = brandType;
        }

        public String getBrandType(){
            return brandType;
        }

        public void setSurplusPort(int surplusPort){
            this.surplusPort = surplusPort;
        }

        public int getSurplusPort(){
            return surplusPort;
        }

        public void setPosDevicePorts(Map<String,String> posDevicePorts){
            this.posDevicePorts = posDevicePorts;
        }

        public Map<String,String> getPosDevicePorts(){
            return posDevicePorts;
        }

        @Override
         public String toString(){
            return
                "EquipmentSlotEntity{" +
                "brandType = '" + brandType + '\'' +
                ",surplusPort = '" + surplusPort + '\'' +
                ",posDevicePorts = '" + posDevicePorts + '\'' +
                "}";
            }
    }
}
